import table from '@/components/dt/table/render.js'


function options(_this, val) {
  return [
  {
    field: 'oldUserName',
    title: '原归属顾问',
    minWidth: 120,
    header: {
      filter: {
        title: '原归属顾问',
        key: 'oldUserName',
        placeholder: '请输入原归属顾问',
        input: {}
      }
    },
    cell: {
      value: (row) => `${row.oldUserName} (${row.oldWorkNo})`,
      text: {}
    }
  },
  {
    field: 'newUserName',
    title: '现归属顾问',
    minWidth: 120,
    header: {
      filter: {
        title: '现归属顾问',
        key: 'newUserName',
        placeholder: '请输入现归属顾问',
        input: {}
      }
    },
    cell: {
      value: (row) => `${row.newUserName} (${row.newWorkNo})`,
      text: {}
    }
  },
  {
    field: 'customerCount',
    title: '客户数',
    minWidth: 120,
    slots: {
      default: (params, h) => {
        return table.cell.btn(_this, h, {
          title: params.row.customerCount,
          event: 'ViewDetails',
          data: params.row
        })
      }
    },
  },
  {
    field: 'operatorName',
    title: '操作人',
    minWidth: 120,
    header: {
      filter: {
        title: '操作人',
        key: 'operatorWorkNo',
        placeholder: '请输入操作人工号',
        input: {}
      }
    },
    cell: {
      value: (row) => `${row.operatorName} (${row.operatorWorkNo})`,
      text: {}
    }
  },
  {
    field: 'createDate',
    title: '操作时间',
    minWidth: 130
  },
  {
    field: 'handles',
    title: '操作',
    minWidth: 150,
    fixed: 'right',
    slots: {
      default: (params, h) => {
        let btns = []
        let item = params.row
        btns.push({
          title: '重新分配',
          event: 'reassign',
          data: item
        })
        btns.push({
          title: '查看明细',
          event: 'ViewDetails',
          data: item
        })
        return table.cell.btns(_this, h, btns)
      }
    }
  }]
}

export default {
  options
}